<template>
  <div class="container">
    <div class="header">
      <span class="prefix">
        <img src="assets/4/11.jpg">
      </span>
      <span class="title">小渝旅游</span>
    </div>
    <div class="main">
      <div class="my-carousel main-item">
        <a-carousel autoplay>
          <div v-for="item in imgList" class="c-img" :key="item"><img :src="item"/></div>
        </a-carousel>
      </div>
      <div class="control main-item">
        <div class="scenic">
          <router-link to="/f" class="scenic-item" :class="{
              'active': activeIndex === 0
            }"><span>四姑娘山</span></router-link>
          <router-link to="/n" class="scenic-item" :class="{
              'active': activeIndex === 1
            }"><span>九寨沟</span></router-link>
        </div>
        <a-spin :spinning="spinning">
          <div class="btn">
            <button @click="onAnalyze">开始爬取</button>
            <router-link :to="resultUrl" :disabled="!showResult">
              <button :class="{ 'disable': !showResult }" @click="onShowResult">查看结果</button>
            </router-link>
          </div>
        </a-spin>
      </div>
    </div>
    <div class="footer">
      <div class="introduction">
        {{ introduction }}
      </div>
    </div>
  </div>
</template>

<script>
// import FixPanel from '@/components/base/FixPanel'

export default {
  name: 'MainBox',
  components: { /*FixPanel*/ },
  props: {
    imgList: Array,
    introduction: String,
    title: String,
    activeIndex: Number,
    resultUrl: String
  },
  data () {
    return {
      showResult: false,
      spinning: false
    }
  },
  methods: {
    onAnalyze () {
      this.spinning = true
      setTimeout(()=> {
        this.spinning = false
        this.showResult = true
      }, 2000)
    },
    onShowResult () {

    }
  }
}
</script>

<style scoped>
.container {
  max-width: 1400px;
  margin: 50px auto;
}

.prefix {
  width: 100px;
  height: 100px;
}

.prefix img{
  width: 100px;
}

.c-img img {
  width: 100%;
}


@media screen and (min-width: 720px) {
  .main {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: stretch;
  }

  .main-item {
    width: 50%;
    margin-right: 20px;
  }
}

@media screen and (max-width: 720px) {
  .main {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: stretch;
  }

  .main-item {
    width: 100%;
    margin-right: 20px;
  }
}

.control {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  flex-direction: column;
}

.control .scenic {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
}

.control .scenic .scenic-item {
  height: 48px;
  line-height: 48px;
  padding-left: 20px;
  width: 100%;
  border: 1px solid #e9e9e9;
  margin-bottom: 10px;
  color: #a0a0a0;
  transition: .4s all linear;
}

.control .scenic .scenic-item:hover {
  background-color: #e9e9e9;
  padding-left: 40px;
  cursor: pointer;
}

.control .scenic .scenic-item.active {
  border-left: 5px solid #1890FF;
  color: #666;
  font-size: 18px;
}

.control .scenic .scenic-item.active:hover {
  background-color: #e9e9e9;
  padding-left: 40px;
  cursor: pointer;
}

.control .btn {
  display: flex;
  justify-content: center;
  flex-direction: column;
  align-items: center;
}

.control .btn button {
  width: 100%;
  margin-top: 20px;
  height: 48px;
  background-color: #1890FF;
  color: white;
  border: none;
  outline: none;
}

.control .btn a {
  width: 100%;
}

.control .btn button:hover {
  cursor: pointer;
  opacity: .8;
}

.control .btn button:active {
  cursor: pointer;
  opacity: 1;
}

.header .title {
  font-size: 32px;
}

.header {
  text-align: left;
  margin-bottom: 20px;
}

.introduction {
  text-align: left;
  line-height: 36px;
  text-indent: 2em;
}

.footer {
  margin-top: 20px;
  padding: 20px;
  border: 1px solid #e9e9e9;
}

.control .btn .disable {
  background-color: #e9e9e9;
}

.control .btn button .disable:hover {
  cursor: not-allowed;
}

</style>